﻿@page
@model FDSimpleModelGenerator.Pages.HistoryModel
@{
    ViewData["Title"] = "生成历史";
    Func<string, string, string> getLink = (fileName, type) =>
    {
        if (type == "Model")
        {
            return fileName;
        }
        return $"{fileName}&type=1";
    };
}

@Html.AntiForgeryToken()
<div class="main">
    <table class="table table-info table-sm table-hover">
        <thead class="thead-dark">
            <tr>
                <th scope="col">#</th>
                <th scope="col">类型</th>
                <th scope="col">日期</th>
                <th scope="col">文件名</th>
                <th scope="col">Ip地址</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var history in Model.Histories)
            {
                <tr class="">
                    <th scope="row">@history.Id</th>
                    <td>@history.GenericType</td>
                    <td>@history.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")</td>
                    @*<td><a href="/?handler=Download&fileName=@getLink(history.ShortFileName, history.GenericType.ToString())" target="_blank">@history.ShortFileName</a></td>*@
                    <td><a href="/viewfile?fileName=@getLink(history.ShortFileName, history.GenericType.ToString())" target="_blank">@history.ShortFileName</a></td>
                    <td>@history.Ip</td>
                </tr>
            }
        </tbody>
    </table>
</div>